Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Sep 16, 2025

Backport of #119682 to release/10.0

/cc @EgorBo

Customer Impact

  • Customer reported
  • Found internally

On NativeAOT (and R2R) certain code patterns could produce non-relocatable addresses leading to crashes. The repro involved an RVA + Unsafe.AsPointer pattern.

Regression

  • Yes
  • No

Looks like the incorrect logic was introduced many releases ago (in a commit from 2022 it was still there).

Testing

Customer's scenario is tested locally

Risk

Low

@EgorBo EgorBo requested a review from jakobbotsch September 16, 2025 12:50
@EgorBo
Copy link
Member

EgorBo commented Sep 16, 2025

PTAL @jakobbotsch backport to 10.0

@jkotas jkotas added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 16, 2025
@jkotas
Copy link
Member

jkotas commented Sep 16, 2025

Do we need a regression test for this?

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@EgorBo
Copy link
Member

EgorBo commented Sep 16, 2025

Do we need a regression test for this?

I was not able to extract a reasonably small repro case out of ZstdSharp (without pinokes/3P), it also seems to be Release only, doesn't repro on Checked. The JIT fix seems to be harmless - it just disables a constant folding for non-relocatable handle + some other const. I suspect it's not the last instance of that problem and we need to refactor the JIT quite a bit, e.g. introduce a special node for constant handles and not re-use general GT_CNS_INT

@EgorBo
Copy link
Member

EgorBo commented Sep 24, 2025

PTAL @AndyAyersMS @dotnet/jit-contrib (since Jakob is OOF)

@EgorBo EgorBo requested a review from AndyAyersMS September 24, 2025 16:35
@JulieLeeMSFT JulieLeeMSFT merged commit 75890de into release/10.0-rc2 Sep 24, 2025
107 of 111 checks passed
@jkotas jkotas deleted the backport/pr-119682-to-release/10.0 branch September 25, 2025 00:02
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants